﻿<div id="d_myAccount">
<?php

include('database.php');

if(isset($_SESSION['connected']))
{
    if($_SESSION['connected'])
    {
        echo '<p class="myaccount">' . $myAccount_connectedAs . $_SESSION['username']; 

        $query = $db->prepare("SELECT tickets FROM user WHERE id= ?");
        $query->execute(array($_SESSION['id']));

        $data = $query->fetch();
        
        if($data['tickets'] == 0)
        {
            echo '<br>' . $myAccount_noTickets . ' (<a href="howToBuyTickets.php">' . $myAccount_buyTickets . '</a>)';
        }
        else
        {
            echo '<br><a href="draws.php">' . $data['tickets'] . $myAccount_unusedTickets . '</a>';
        }
        
        echo '</p>';
    }
}

?>
</div>